clc,clear all,close all
clear all; close all; clc;
N = 1e5;
x=rand(1, N);
figure(1)
hist(x);
xlabel('x');xlim([0 1]);
a = 10; b = 22; x = x*(b-a) + a;
dx = 0.01;
[h, xb] = hist(x, a-dx/2:dx:b+dx/2);
figure(2)
p = h / (sum(h) * dx);
plot(xb, p);
ylim([0 0.3]);
xlabel('x'); ylabel('p(x)');
